package cn.htu.javaSong.controller;


import cn.htu.javaSong.common.ResponseModel;
import cn.htu.javaSong.service.ISongService;
import org.springframework.web.bind.annotation.*;

import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author dakai
 * @since 2024-10-26
 */
@RestController
@RequestMapping("/song")
public class SongController {

    @Resource
    private ISongService iSongService;

    @PostMapping("/uploadMp3")
    public ResponseModel uploadMp3File(@RequestParam("file") MultipartFile file) {
        return iSongService.addSong(file);
    }

    @PostMapping("/uploadFilesMp3")
    public ResponseModel uploadMp3File(@RequestParam("files") List<MultipartFile> files) {
        return iSongService.addSongs(files);
    }

}
